fail -> panic
authorSteve Klabnik <steve@steveklabnik.com>
Thu, 30 Oct 2014 01:59:06 +0000 (21:59 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Thu, 30 Oct 2014 01:59:06 +0000 (21:59 -0400)
src/cargo/core/shell.rs
src/cargo/core/source.rs
src/cargo/sources/git/source.rs
src/cargo/util/sha256.rs
tests/support/mod.rs
tests/test_cargo_bench.rs
tests/test_cargo_compile.rs
tests/test_cargo_run.rs
tests/test_cargo_test.rs

index f1c71f47ec7eb426928cd3b3a361bdd7fb2744ce..b5570f0ddb1409dd628613f5f158b39f01810797 100644 (file)
@@ -169,7 +169,7 @@ impl<'a> Terminal<Box<Writer+'a>> for Shell<'a> {
     }
 
     fn unwrap(self) -> Box<Writer+'a> {
-        fail!("Can't unwrap a Shell");
+        panic!("Can't unwrap a Shell");
     }
 
     fn get_ref<'b>(&'b self) -> &'b Box<Writer+'a> {
index cde5523d8640c8712f6e17d7d158240f435173bd..3d9a717f1d2b0b5a51bd3530b55bbb3ca3adc4ab 100644 (file)
@@ -118,14 +118,14 @@ impl SourceId {
                          .with_precise(Some("locked".to_string()))
             }
             "path" => SourceId::for_path(&Path::new(url.slice_from(5))).unwrap(),
-            _ => fail!("Unsupported serialized SourceId")
+            _ => panic!("Unsupported serialized SourceId")
         }
     }
 
     pub fn to_url(&self) -> String {
         match *self.inner {
             SourceIdInner { kind: PathKind, .. } => {
-                fail!("Path sources are not included in the lockfile, \
+                panic!("Path sources are not included in the lockfile, \
                        so this is unimplemented")
             },
             SourceIdInner {
@@ -192,7 +192,7 @@ impl SourceId {
             PathKind => {
                 let path = match self.inner.url.to_file_path() {
                     Ok(p) => p,
-                    Err(()) => fail!("path sources cannot be remote"),
+                    Err(()) => panic!("path sources cannot be remote"),
                 };
                 box PathSource::new(&path, self) as Box<Source>
             },
index 870bcaa3e800056b5b7f62b708d07514d7544dbf..7febd60800d54167e46e7f4a75fc4a880d35a70a 100644 (file)
@@ -30,7 +30,7 @@ impl<'a, 'b> GitSource<'a, 'b> {
 
         let reference = match source_id.git_reference() {
             Some(reference) => reference,
-            None => fail!("Not a git source; id={}", source_id),
+            None => panic!("Not a git source; id={}", source_id),
         };
 
         let remote = GitRemote::new(source_id.get_url());
index 294bdbaba2c39fa0f74e8fb273223240fc26bbf0..19a24a8dcd4546141a2f11d7acd0f001d50dfb48 100644 (file)
@@ -109,7 +109,7 @@ mod imp {
 
     macro_rules! call( ($e:expr) => ({
         if $e == 0 {
-            fail!("failed {}: {}", stringify!($e), os::last_os_error())
+            panic!("failed {}: {}", stringify!($e), os::last_os_error())
         }
     }) )
 
index cb8f1644370d0c34f48ea60f8e290311bd79cca4..544e9800df2598b194a639fd9a56eb069ee967ef 100644 (file)
@@ -144,7 +144,7 @@ impl ProjectBuilder {
     // TODO: return something different than a ProjectBuilder
     pub fn build(&self) -> &ProjectBuilder {
         match self.build_with_result() {
-            Err(e) => fail!(e),
+            Err(e) => panic!(e),
             _ => return self
         }
     }
@@ -227,7 +227,7 @@ pub fn cargo_dir() -> Path {
     os::getenv("CARGO_BIN_PATH").map(Path::new)
         .or_else(|| os::self_exe_path())
         .unwrap_or_else(|| {
-            fail!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
+            panic!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
         })
 }
 
@@ -327,7 +327,7 @@ impl Execs {
                         (None, Some(e)) => {
                             Some(format!("{:3} - |{}|\n    +\n", i, e))
                         },
-                        (None, None) => fail!("Cannot get here")
+                        (None, None) => panic!("Cannot get here")
                     }
                 });
 
@@ -450,7 +450,7 @@ impl<T,E: Show> ResultTest<T,E> for Result<T,E> {
     fn assert(self) -> T {
         match self {
             Ok(val) => val,
-            Err(err) => fail!("Result was error: {}", err)
+            Err(err) => panic!("Result was error: {}", err)
         }
     }
 }
@@ -459,7 +459,7 @@ impl<T> ResultTest<T,()> for Option<T> {
     fn assert(self) -> T {
         match self {
             Some(val) => val,
-            None => fail!("Option was None")
+            None => panic!("Option was None")
         }
     }
 }
index a661d795ee631884ab65fe2f5fbad2698c5b4a6d..e6efc9e624cc8d17c078b2f1e40303d24a9514fd 100644 (file)
@@ -401,7 +401,7 @@ test!(dont_run_examples {
         .file("src/lib.rs", r#"
         "#)
         .file("examples/dont-run-me-i-will-fail.rs", r#"
-            fn main() { fail!("Examples should not be run by 'cargo test'"); }
+            fn main() { panic!("Examples should not be run by 'cargo test'"); }
         "#);
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0));
index f8b777813331b92d3dcc73a5bc778eec1b5c4d39..9b8d74ed02c3fa263617f47d580b0f57e882fd5d 100644 (file)
@@ -628,7 +628,7 @@ test!(custom_build_failure {
             name = "foo"
         "#)
         .file("src/foo.rs", r#"
-            fn main() { fail!("nope") }
+            fn main() { panic!("nope") }
         "#);
     assert_that(build.cargo_process("build"), execs().with_status(0));
 
@@ -691,7 +691,7 @@ test!(custom_second_build_failure {
             name = "bar"
         "#)
         .file("src/bar.rs", r#"
-            fn main() { fail!("nope") }
+            fn main() { panic!("nope") }
         "#);
     assert_that(build2.cargo_process("build"), execs().with_status(0));
 
index 97fc5e31cdba10719eec56d3ba3bd119204c9f4e..4f8270ba0f55617430c12516d406e13e7e9efbe4 100644 (file)
@@ -260,7 +260,7 @@ test!(release_works {
             authors = []
         "#)
         .file("src/main.rs", r#"
-            fn main() { if !cfg!(ndebug) { fail!() } }
+            fn main() { if !cfg!(ndebug) { panic!() } }
         "#);
 
     assert_that(p.cargo_process("run").arg("--release"),
index 901499c44d0d67fadcdf30341a047077226f3655..c4cb668bd1a6dadefabc43df17d8976ac1e58c3e 100644 (file)
@@ -390,7 +390,7 @@ test!(dont_run_examples {
         .file("src/lib.rs", r#"
         "#)
         .file("examples/dont-run-me-i-will-fail.rs", r#"
-            fn main() { fail!("Examples should not be run by 'cargo test'"); }
+            fn main() { panic!("Examples should not be run by 'cargo test'"); }
         "#);
     assert_that(p.cargo_process("test"),
                 execs().with_status(0));
@@ -855,7 +855,7 @@ test!(test_no_run {
         "#)
         .file("src/lib.rs", "
             #[test]
-            fn foo() { fail!() }
+            fn foo() { panic!() }
         ");
 
     assert_that(p.cargo_process("test").arg("--no-run"),